window.onload=function(){
    //设置结束时间
    var endTime=new Date("2018-11-23 21:40:10");
    function seckill(){

    var nowTime=new Date();

    var interval=endTime.getTime() - nowTime.getTime();
    if(interval<=999){
        clearInterval(timer);
    }

    var day=Number.parseInt(interval/(24*60*60*1000));

    var hour=Number.parseInt((interval-day*(24*60*60*1000))/(60*60*1000));

    var minute=Number.parseInt((interval%(60*60*1000))/(60*1000));

    var second=Number.parseInt((interval%(60*1000))/(1000));

    daydiv=document.getElementsByClassName('day')[0];
    daydiv.innerHTML=day+"天";

    hourdiv=document.getElementsByClassName('hour')[0];
    hourdiv.innerHTML=hour+"时";

    minutediv=document.getElementsByClassName('minute')[0];
    minutediv.innerHTML=minute+"分";

    seconddiv=document.getElementsByClassName('second')[0];
    seconddiv.innerHTML=second+"秒";
}
var timer=setInterval(seckill,1000);
}